import request from "@/utils/request";
/**
 * 分页列表每个元素的类型
 */
export interface trademarkItemType {
  id?: number;
  tmName: string;
  logoUrl: string;
}
/**
 * 分页列表数组类型
 */
export type trademarkIlistType = trademarkItemType[];
/**
 * 分页列表返回值类型
 */
export interface trademarkInfoType {
  records: trademarkIlistType;
  total: number;
  size: number;
  current: number;
  searchCount: boolean;
  pages: number;
}
/**
 * 分页列表请求
 * @param page 当前页
 * @param limit 每页条数
 * @returns
 */
export const reqTrademarkInfo = (page: number, limit: number) => {
  return request.get<null, trademarkInfoType>(
    `/admin/product/baseTrademark/${page}/${limit}`
  );
};
/**
 * 添加品牌请求
 * @param tmInfo 品牌属性
 * @returns
 */
export const reqAddTrademark = (tmInfo: trademarkItemType) => {
  return request.post<null, null>(`/admin/product/baseTrademark/save`, tmInfo);
};
/**
 * 修改品牌请求
 * @param tmInfo
 * @returns
 */
export const reqUpdateTrademark = (tmInfo: trademarkItemType) => {
  return request.put<null, null>(`/admin/product/baseTrademark/update`, tmInfo);
};
/**
 * 删除品牌请求
 * @param id
 * @returns
 */
export const reqDeleteTrademark = (id: number) => {
  return request.delete<null, null>(
    `/admin/product/baseTrademark/remove/${id}`
  );
};
/**
 * 请求获取所有的品牌列表
 * @returns
 */
export const reqTrademarkList = () => {
  return request.get<null,trademarkIlistType>(`/admin/product/baseTrademark/getTrademarkList`);
};
